package com.tianpengtech.common.validator.rules.numberic;

import com.tianpengtech.common.exception.ValidateException;
import com.tianpengtech.common.validator.AbstractRule;

public class NumbericMustBeGreaterEqualThan extends AbstractRule {

    private long expectedValue;

    public NumbericMustBeGreaterEqualThan(long v, long expectedValue, String msg) {
        this.value = v;
        this.msg = msg;
        this.expectedValue = expectedValue;
    }

    @Override
    public boolean validate() throws ValidateException {

        long v = (Long) this.value;
        if (v < this.expectedValue) {
            throw new ValidateException(this.msg);
        }
        return true;
    }
}
